#!/usr/bin/env python
# -*- coding:utf-8 -*- 
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:

"""
@version: 1.0
@author: readerror
@contact: readerror@readerror.cn
@contact1: readerror000@gmail.com
@site: http://www.readerror.cn
@software: PyCharm
@file: user.py
@time: 2017/3/22 10:02
"""


def query_account(client):
    return client.query_account()


def query_account_by_uuid(client, uuid):
    data = {'conditions': [{'name': 'uuid',
                            'op': '=',
                            'value': uuid}]}
    return client.query_account(data)


def create_account(client, username, password):
    data = {'name': username, 'password': client.hash_password(password)}
    return client.create_account(data)


def delete_account(client, uuid):
    data = {'uuid': uuid}
    return client.delete_account(data)


def update_account(client, uuid, password):
    data = {'password': client.hash_password(password), 'uuid': uuid}
    return client.update_account(data)
